{extend name="../../admin/view/public/admin"}

{block name='content'}


<style>
    .multi-item {
        margin-bottom: 18px;
    }
</style>

<div class="page-header">
    当前位置：<span class="text-primary">{if !empty($item)}编辑{else}新建{/if}文章
    	<small>{if !empty($item)}(名称: {$item['title']}){/if}</small>
    </span>
</div>

<div class="page-content">

    <form action="" method="post" class="form-validate form-horizontal ">
        <input type="hidden" name="id" value="{$item['id']}"/>
        <input type="hidden" id="tab" name="tab" value="{if empty($_GET['tab'])}#tab_basic{else}#tab_{$_GET['tab']}{/if}"/>

        <div class="tabs-container tab-goods">
            <div class="tabs-left">
                <ul class="nav nav-tabs" id="myTab">
                    <li {if empty($_GET['tab']) || $_GET['tab']=='basic'}class="active"{/if}><a href="#tab_basic">基础设置</a></li>
                    <!-- <li {if $_GET['tab']=='audio'}class="active"{/if}><a href="#tab_audio">音/视频</a></li> -->
                    <li {if $_GET['tab']=='content'}class="active"{/if}><a href="#tab_content">内容设置</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-content">

                        <div class="tab-pane {if empty($_GET['tab']) || $_GET['tab']=='basic'}active{/if}" id="tab_basic">
                            <div class="form-group">
                                <label class="col-lg control-label must">排序</label>
                                <div class="col-sm-9 col-xs-12">
                                    <input type="text" name="displayorder" class="form-control" value="{:intval($item['displayorder'])}" data-rule-required='true'/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label must">分类</label>
                                <div class="col-sm-9 col-xs-12">
                                    <select name='cateid' class='form-control'>
                                        <option value="">选择主分类</option>
                                        {foreach $categorys as $key => $row}
                                        <option value="{$row['id']}" {if $row['id']==$item['cateid']}selected{/if}>{$row['name']}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label must">文章标题</label>
                                <div class="col-sm-9 col-xs-12">
                                    <input type="text" name="title" class="form-control" value="{$item['title']}" data-rule-required='true'/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">文章封面图</label>
                                <div class="col-sm-9 col-xs-12">
                                    {:tpl_form_field_image('thumb', $item['thumb'])}
                                    <span class="help-block">尺寸建议比例为 16:9 </span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">文章描述</label>
                                <div class="col-sm-9 col-xs-12">
                                    <textarea class="form-control" rows="5" name="description">{$item['description']}</textarea>
                                    <span class="help-block">文章描述：分享后描述使用 利于搜索引擎搜索</span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">作者(选填)</label>
                                <div class="col-sm-9">
                                    <input type="text" name="author" class="form-control" value="{$item['author']}" placeholder="作者名称">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">编辑(选填)</label>
                                <div class="col-sm-9">
                                    <input type="text" name="editor" class="form-control" value="{$item['editor']}" placeholder="编辑名称">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">来源(选填)</label>
                                <div class="col-sm-6">
                                    <input type="text" name="article_mp" class="form-control" value="{$item['article_mp']}" placeholder="应用名称">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">文章发布日期</label>
                                <div class="col-sm-9">
                                    {:tpl_form_field_date('showtime',$item['showtime'],true)}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">阅读数</label>
                                <div class="col-sm-3">
                                    <input type="text" name="viewcount_v" class="form-control" value="{$item['viewcount_v']}" placeholder="虚拟阅读数" bind-in="art_read" bind-de="0" bind-num='1'>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">显示状态</label>
                                <div class="col-sm-9 col-xs-12">
                                    <label class="radio-inline">
                                        <input type="radio" name="enabled" value="0" {if $item['enabled']==0 || empty($item)}checked="checked"{/if}> 隐藏
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="enabled" value="1" {if $item['enabled']==1}checked="checked"{/if}> 显示
                                    </label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-lg control-label">是否原创</label>
                                <div class="col-sm-9 col-xs-12">
                                    <label class="radio-inline">
                                        <input type="radio" name="is_original" value="0" {if $item['is_original']==0 || empty($item)}checked="checked"{/if}> 否
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="is_original" value="1" {if $item['is_original']==1}checked="checked"{/if}> 是
                                    </label>
                                </div>
                            </div>
                        </div>

                        <!-- <div class="tab-pane {if $_GET['tab']=='audio'}active{/if}" id="tab_audio"> -->
                        <!--     <div class="form-group"> -->
                        <!--         <label class="col-lg control-label">音频</label> -->
                        <!--         <div class="col-sm-9"> -->
                        <!--             {:tpl_form_field_audio('audio_url',$item['audio_url'])} -->
                        <!--         </div> -->
                        <!--     </div> -->

                        <!--     <div class="form-group"> -->
                        <!--         <label class="col-lg control-label">视频封面图片</label> -->
                        <!--         <div class="col-sm-9"> -->
                        <!--             {:tpl_form_field_image('video_poster',$item['video_poster'])} -->
                        <!--             <span class="help-block">建议尺寸（750px*440px）</span> -->
                        <!--         </div> -->
                        <!--     </div> -->

                        <!--     <div class="form-group"> -->
                        <!--         <label class="col-lg control-label">视频URL地址</label> -->
                        <!--         <div class="col-sm-9 col-xs-12"> -->
                        <!--             {:tpl_form_field_video2('video_url', $item['video_url'], array('disabled'=>false, 'network'=>true, 'placeholder'=>'请选择视频'))} -->
                        <!--             <span class='help-block'>设置后详情显示封面及视频</span> -->
                        <!--         </div> -->
                        <!--     </div> -->
                        <!-- </div> -->

                        <div class="tab-pane {if $_GET['tab']=='content'}active{/if}" id="tab_content">
                            <div class="form-group">
                                <label class="col-lg control-label">文章内容</label>
                                <div class="col-sm-9">
                                    {include file='web/article/index/tpl/content'}
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9">
                <input type="submit" class="btn btn-primary" value="保存">
                <a class="btn btn-default" href="{:webUrl('web.article.index/main')}">返回列表</a>
            </div>
        </div>

    </form>
</div>
<script type="text/javascript">
    require(['bootstrap'], function () {
        $('#myTab a').click(function (e) {
            $('#tab').val($(this).attr('href'));
            e.preventDefault();
            $(this).tab('show');
        })
    });
</script>
{/block}